@if($purchase->order_contract->isNotEmpty())
<div class="box box-solid no-margin box-show">
    <div class="box-body">
        <h4>合同文件</h4>
        <div class="box-body table-responsive no-padding">
            <table class="table">
                <thead>
                <tr>
                    <th style="width: 25%">名称</th>
                    <th style="width: 25%">类型</th>
                    <th style="width: 25%">生成时间</th>
                    <th style="width: 25%">操作</th>
                </tr>
                </thead>
                <tbody>
                    @foreach($purchase->order_contract as $item)
                        <tr>
                            <td>{{ \App\Models\Purchase\PurchaseOrderContract::fileName($item->purchase_no,$item->type) }}</td>
                            <td>{{ \App\Models\Purchase\PurchaseOrderContract::$_type[$item->type] }}</td>
                            <td>{{ $item->created_at }}</td>
                            <td>
                                <button class="btn btn-xs btn-default contract_export" data-id="{{ $item->id }}"><i class="fa fa-download"></i> 下载</button>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $('.contract_export').on('click', function (e) {
            e.preventDefault();
            var id = $(this).data('id');
            window.location.href = '/xqc/purchase/yj-order-modal?action=exportPurContract&param=' + id;
        });
    });
</script>
@endif
